//
//  AppDelegate.m
//  Codex
//
//  Created by ChenJie on 2/8/21.
//

#import "AppDelegate.h"
#import "ViewController.h"

@interface AppDelegate ()

@property (nonatomic, strong) UIViewController *rootVc;

@end

@implementation AppDelegate

#pragma mark - Application lifecycle

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    // build root view controller
    [self buildRootVc];
    
    return YES;
}

#pragma mark - Public methods



#pragma mark - Private methods

- (void)buildRootVc {
    self.window.rootViewController = self.rootVc;
    [self.window makeKeyAndVisible];
}

#pragma mark - Deletate methods



#pragma mark - Setter



#pragma mark - Getter

- (UIWindow *)window {
    if (!_window) {
        UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
        _window = window;
    }
    return _window;
}

- (UIViewController *)rootVc {
    if (!_rootVc) {
        ViewController *vc = [ViewController new];
        UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
        _rootVc = nav;
    }
    return _rootVc;
}

#pragma mark - Memory Management



@end
